<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">
<!-- TopJUI框架样式 -->
<link type="text/css" href="../../topjui/themes/default/topjui.core.min.css" rel="stylesheet">
<link type="text/css" href="../../topjui/themes/default/topjui.blue.css" rel="stylesheet" id="dynamicTheme" />
<!-- FontAwesome字体图标 -->
<link type="text/css" href="../../statics/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<!-- layui框架样式 -->
<link type="text/css" href="../../statics/plugins/layui/css/layui.css" rel="stylesheet" />
<!-- jQuery相关引用 -->
<script type="text/javascript" src="../../statics/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../statics/plugins/jquery/jquery.cookie.js"></script>
<!-- TopJUI框架配置 -->
<script type="text/javascript" src="../../statics/public/js/topjui.config.js"></script>
<!-- TopJUI框架核心-->
<script type="text/javascript" src="../../topjui/js/topjui.core.min1.js"></script>
<!-- TopJUI中文支持 -->
<script type="text/javascript" src="../../topjui/js/locale/topjui.lang.zh_CN.js"></script>
<!-- layui框架js -->
<script type="text/javascript" src="../../statics/plugins/layui/layui.js" charset="utf-8"></script>

<script type="text/javascript" src="../../statics/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="../../statics/plugins/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../statics/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
<!-- 上传组件 -->
<link type="text/css" rel="stylesheet" href="../../statics/plugins/webuploader/css/webuploader.css">
<script type="text/javascript" src="../../statics/plugins/webuploader/js/webuploader.min.js"></script>
</head>
<body>
<div class="topjui-container">
    <fieldset>
        <legend>由excel文件导入员工信息</legend>
    </fieldset>
    <!-- <form name="inputFileForm" id="inputFileForm" enctype="multipart/form-data" > -->
	<form id='inputFileForm' data-toggle="topjui-form">
    <div class="topjui-row">
        <div class="topjui-col-sm8">
            <label class="topjui-form-label">请选择文件：</label>
            <div class="topjui-input-block">
                <input type="text" name="userFile" id="userFile"
                       data-toggle="topjui-filebox"
                       data-options="prompt:'请选择Excel文件',buttonIcon:'fa fa-file',
				                     accept:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel'
                       ">
            </div>
        </div>
        <div class="topjui-col-sm4">
            <div class="topjui-input-block">
                       <a href="javascript:void(0)" data-toggle="topjui-menubutton"
			data-options="btnCls:'topjui-btn-red'" onclick="importExcel()">导入</a>

            </div>
        </div>
    </div>
    </form>
    <a href="javascript:void(0)"
       data-toggle="topjui-menubutton"
       data-options="method:'upload',
       extend:'#productDg-toolbar',
       iconCls:'fa fa-cloud-upload',
       btnCls:'topjui-btn-green',
       accept:'file',
       dialog:{
           title:'附件批量上传'
       },
       parentGrid:{type:'datagrid', id:'productDg'},
       uploadUrl:_ctx + '/json/response/upload.json?uuid={uuid}'">批量上传</a>

</div>
<script>
$(function(){ 
	/*
	$('#inputFileForm').form({    
	    url:'/report/importusers',    
	    onSubmit: function(){    
	        var file = $('#userFile').filebox("getText");
	        //判断文件上传是否为空
	        if (file == null || file == "") {
	            $.messager.alert('系统提示', '请选择将要上传的文件!');
	            return false;
	        }
	        // return false to prevent submit;    
	    },    
	    success:function(data){    
	        if (data == 'True') {
	            $.messager.show({
	                title: '提示',
	                msg: '用户批量导入成功',
	                showType: 'slide'
	            })
	            $('#userFile').filebox("setText", "");
	
	        } else {
	            //$.messager.alert('警告', '导入异常，请检查是否正确使用模板！')
	            $.messager.alert('提示', data)
	        }
	    }    
	});	
	*/
	$("#inputFileForm").form('submit', {
        url: '/report/importusers',
        data: $("#inputFileForm").serialize(),
        success: function (result) {

        }
    });
});
function importExcel() {
	/*
    var file = $('#userFile').filebox("getText");
    //判断文件上传是否为空
    if (file == null || file == "") {
        $.messager.alert('系统提示', '请选择将要上传的文件!');
        return;
    }
	var options = {
	    method: 'POST',
	    url: '/report/importusers',
	    data: file,
	    dataType: 'text',
	    success: function (data) {
	        if (data == 'True') {
	            $.messager.show({
	                title: '提示',
	                msg: '用户批量导入成功',
	                showType: 'slide'
	            })
	            $('#userFile').filebox("setText", "");
	
	        } else {
	            //$.messager.alert('警告', '导入异常，请检查是否正确使用模板！')
	            $.messager.alert('提示', data)
	        }
	    }
	}
	*/

	$('#inputFileForm').submit();
}
</script>
</body>
</html>